package com.deyuanyun.pic.pipe.controller.vo;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.domain.PipeSegmentInfo;
import com.deyuanyun.pic.pipe.domain.bo.PipeSegmentInfoBO;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;
import com.sun.org.apache.bcel.internal.classfile.Code;

/**
 * 管段信息表
 */
public class PipeSegmentInfoVO extends BaseVO<PipeSegmentInfoBO> {

    // 管道id
    private String pipeLineId;
    // 管段id
    private String pipeSegmentId;
    // 起始阀室id
    private String fromPipeValveRoomId;
    // 终点阀室id
    private String toPipeValveRoomId;
    // 管道名称
    private String pipeLineName;
    // 管段名称
    private String pipeSegmentName;
    // 起始阀室名称
    private String fromPipeValveRoomName;
    // 终点阀室名称
    private String toPipeValveRoomName;
    // 管道类别
    private String pipelineType;
    // 投用日期
    private String inserviceTime;
    // 运行状态
    private String operationalStatus;
    // 设计长度（m）
    private String designLength;
    // 计算长度（m）
    private String countLength;
    // 管径(mm)
    private String diameter;
    // 壁厚（mm）
    private String wallthickness;
    // 管材
    private String material;
    // 制管方式
    private String coatingmaterial;
    // 防腐材料
    private String manupipeType;
    // 防腐等级
    private String coatingGrade;
    // 补口材料
    private String jointMaterial;
    // 内涂层材料
    private String incoatingMaterial;
    // 阴保方式
    private String cpType;
    // 设计输量（104m3/d）
    private String designTranYear;
    // 设计压力（MPa）
    private String pressureRating;
    // 输送介质
    private String mediumType;
    // 干气或湿气
    private String dryOrWet;
    // 硫化氢含量（mg/m3）
    private String h2s;
    // 管线功能
    private String pipeFunction;
    // 设计单位
    private String designUnit;
    // 施工单位
    private String construcion;
    // 监理单位
    private String supervision;
    // 检测单位
    private String testingCompany;
    // GISID
    private String gisId;

    public String getPipeLineId() {
        return pipeLineId;
    }

    public void setPipeLineId(String pipeLineId) {
        this.pipeLineId = pipeLineId;
    }

    public String getPipeSegmentId() {
        return pipeSegmentId;
    }

    public void setPipeSegmentId(String pipeSegmentId) {
        this.pipeSegmentId = pipeSegmentId;
    }

    public String getFromPipeValveRoomId() {
        return fromPipeValveRoomId;
    }

    public void setFromPipeValveRoomId(String fromPipeValveRoomId) {
        this.fromPipeValveRoomId = fromPipeValveRoomId;
    }

    public String getToPipeValveRoomId() {
        return toPipeValveRoomId;
    }

    public void setToPipeValveRoomId(String toPipeValveRoomId) {
        this.toPipeValveRoomId = toPipeValveRoomId;
    }

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getPipeSegmentName() {
        return pipeSegmentName;
    }

    public void setPipeSegmentName(String pipeSegmentName) {
        this.pipeSegmentName = pipeSegmentName;
    }

    public String getFromPipeValveRoomName() {
        return fromPipeValveRoomName;
    }

    public void setFromPipeValveRoomName(String fromPipeValveRoomName) {
        this.fromPipeValveRoomName = fromPipeValveRoomName;
    }

    public String getToPipeValveRoomName() {
        return toPipeValveRoomName;
    }

    public void setToPipeValveRoomName(String toPipeValveRoomName) {
        this.toPipeValveRoomName = toPipeValveRoomName;
    }

    public String getPipelineType() {
        return pipelineType;
    }

    public void setPipelineType(String pipelineType) {
        this.pipelineType = pipelineType;
    }

    public String getInserviceTime() {
        return inserviceTime;
    }

    public void setInserviceTime(String inserviceTime) {
        this.inserviceTime = inserviceTime;
    }

    public String getOperationalStatus() {
        return operationalStatus;
    }

    public void setOperationalStatus(String operationalStatus) {
        this.operationalStatus = operationalStatus;
    }

    public String getDesignLength() {
        return designLength;
    }

    public void setDesignLength(String designLength) {
        this.designLength = designLength;
    }

    public String getDiameter() {
        return diameter;
    }

    public void setDiameter(String diameter) {
        this.diameter = diameter;
    }

    public String getWallthickness() {
        return wallthickness;
    }

    public void setWallthickness(String wallthickness) {
        this.wallthickness = wallthickness;
    }

    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    public String getCoatingmaterial() {
        return coatingmaterial;
    }

    public void setCoatingmaterial(String coatingmaterial) {
        this.coatingmaterial = coatingmaterial;
    }

    public String getManupipeType() {
        return manupipeType;
    }

    public void setManupipeType(String manupipeType) {
        this.manupipeType = manupipeType;
    }

    public String getCoatingGrade() {
        return coatingGrade;
    }

    public void setCoatingGrade(String coatingGrade) {
        this.coatingGrade = coatingGrade;
    }

    public String getJointMaterial() {
        return jointMaterial;
    }

    public void setJointMaterial(String jointMaterial) {
        this.jointMaterial = jointMaterial;
    }

    public String getIncoatingMaterial() {
        return incoatingMaterial;
    }

    public void setIncoatingMaterial(String incoatingMaterial) {
        this.incoatingMaterial = incoatingMaterial;
    }

    public String getCpType() {
        return cpType;
    }

    public void setCpType(String cpType) {
        this.cpType = cpType;
    }

    public String getDesignTranYear() {
        return designTranYear;
    }

    public void setDesignTranYear(String designTranYear) {
        this.designTranYear = designTranYear;
    }

    public String getPressureRating() {
        return pressureRating;
    }

    public void setPressureRating(String pressureRating) {
        this.pressureRating = pressureRating;
    }

    public String getMediumType() {
        return mediumType;
    }

    public void setMediumType(String mediumType) {
        this.mediumType = mediumType;
    }

    public String getDryOrWet() {
        return dryOrWet;
    }

    public void setDryOrWet(String dryOrWet) {
        this.dryOrWet = dryOrWet;
    }

    public String getH2s() {
        return h2s;
    }

    public void setH2s(String h2s) {
        this.h2s = h2s;
    }

    public String getPipeFunction() {
        return pipeFunction;
    }

    public void setPipeFunction(String pipeFunction) {
        this.pipeFunction = pipeFunction;
    }

    public String getDesignUnit() {
        return designUnit;
    }

    public void setDesignUnit(String designUnit) {
        this.designUnit = designUnit;
    }

    public String getConstrucion() {
        return construcion;
    }

    public void setConstrucion(String construcion) {
        this.construcion = construcion;
    }

    public String getSupervision() {
        return supervision;
    }

    public void setSupervision(String supervision) {
        this.supervision = supervision;
    }

    public String getTestingCompany() {
        return testingCompany;
    }

    public void setTestingCompany(String testingCompany) {
        this.testingCompany = testingCompany;
    }

    public String getCountLength() {
        return countLength;
    }

    public void setCountLength(String countLength) {
        this.countLength = countLength;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    public void fromDomain(PipeSegmentInfoBO domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道id
        this.pipeLineId = domain.getPipeLineId();
        // 管段id
        this.pipeSegmentId = domain.getPipeSegmentId();
        // 起始阀室id
        this.fromPipeValveRoomId = domain.getFromPipeValveroomId();
        // 终点阀室id
        this.toPipeValveRoomId = domain.getToPipeValveroomId();
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 管段名称
        this.pipeSegmentName = PipeLineUtil.getPipeSegmentName(domain.getPipeSegmentId());
        // 起始阀室名称
        this.fromPipeValveRoomName = PipeLineUtil.getValveRoomName(domain.getFromPipeValveroomId());
        // 终点阀室名称
        this.toPipeValveRoomName = PipeLineUtil.getValveRoomName(domain.getToPipeValveroomId());
        // 管道类别
        this.pipelineType = CodeUtil.getName(domain.getPipelineType());
        // 投用日期
        this.inserviceTime = DateFormat.format(domain.getInserviceTime());
        // 运行状态
        this.operationalStatus = CodeUtil.getName(domain.getOperationalStatus());
        // 设计长度（m）
        this.designLength = NumberFormat.format(domain.getDesignLength());
        // 计算长度（m）
        this.countLength = NumberFormat.format(domain.getCountLength(), NumberFormat.FMT_PLACES3);
        // 管径(mm)
        this.diameter = CodeUtil.getName(domain.getDiameter());
        // 壁厚（mm）
        this.wallthickness = NumberFormat.format(domain.getWallthickness());
        // 管材
        this.material = CodeUtil.getName(domain.getMaterial());
        // 制管方式
        this.coatingmaterial = CodeUtil.getName(domain.getCoatingmaterial());
        // 防腐材料
        this.manupipeType = CodeUtil.getName(domain.getManupipeType());
        // 防腐等级
        this.coatingGrade = CodeUtil.getName(domain.getCoatingGrade());
        // 补口材料
        this.jointMaterial =CodeUtil.getName( domain.getJointMaterial());
        // 内涂层材料
        this.incoatingMaterial = CodeUtil.getName(domain.getIncoatingMaterial());
        // 阴保方式
        this.cpType = CodeUtil.getName(domain.getCpType());
        // 设计输量（104m3/d）
        this.designTranYear = NumberFormat.format(domain.getDesignTranYear());
        // 设计压力（MPa）
        this.pressureRating = NumberFormat.format(domain.getPressureRating());
        // 输送介质
        this.mediumType = CodeUtil.getName(domain.getMediumType());
        // 干气或湿气
        this.dryOrWet = CodeUtil.getName(domain.getDryOrWet());
        // 硫化氢含量（mg/m3）
        this.h2s = domain.getH2s();
        // 管线功能
        this.pipeFunction = CodeUtil.getName(domain.getPipeFunction());
        // 设计单位
        this.designUnit = domain.getDesignUnit();
        // 施工单位
        this.construcion = domain.getConstrucion();
        // 监理单位
        this.supervision = domain.getSupervision();
        // 检测单位
        this.testingCompany = domain.getTestingCompany();
        // gis地址
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<PipeSegmentInfoVO> fromDomainList(Page<PipeSegmentInfoBO> domainList) {
        Page<PipeSegmentInfoVO> list = new Page<PipeSegmentInfoVO>();
        for (PipeSegmentInfoBO pipeSegmentInfoBO : domainList) {
            PipeSegmentInfoVO pipeSegmentInfoVO = new PipeSegmentInfoVO();
            pipeSegmentInfoVO.fromDomain(pipeSegmentInfoBO);
            list.add(pipeSegmentInfoVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}